import json

from flask import Blueprint
from flask import request
from flask import Response

from app.comm.db import db
from app.comm.db import jsonformater
from app.comm.pub import RestEntity
from app.comm.pub import class2dict

noticeservice = Blueprint('notice', __name__,)

@noticeservice.route("/rest/system/notice/list",methods=['POST','GET'])
def noticeList():  
    #dict1 = json.loads(a)
    tables=db.session.execute("select notice_id noticeId,notice_title noticeTitle,notice_type noticeType,notice_content noticeContent,status,create_time createTime,remark from sys_notice").fetchall()
    datas= [dict(r) for r in tables] 
    result=RestEntity(0,0,datas,"登陆成功！")
    return json.dumps(class2dict(result), default=jsonformater)
 
    #return json.dumps(dict1)         